package org.opens.javaskill.strategyMode.if_else.conditional;

import org.opens.javaskill.strategyMode.if_else.ConditionalResult;

import java.util.Date;

/**
 * 功能:
 *      1. 条件工厂: 根据传入的参数进行返回不同的实例对象.
 *      2. 该工厂构造私有, 获取实例的方法为静态.
 */
public class ConditionalFactory {

    private ConditionalFactory() {}

    public static ConditionalResult getInstance(Date startTime, Date endTime) {
        if(startTime != null && endTime != null) {
            return new StartAndEndIsNotNull();
        } else {
            return new StartOrEndIsNull();
        }
    }

}
